
//格式化时间
function createTime(v){
    var date = new Date(v);
    var y = date.getFullYear();
    var m = date.getMonth()+1;
    m = m<10?'0'+m:m;
    var d = date.getDate();
    d = d<10?("0"+d):d;
    var h = date.getHours();
    h = h<10?("0"+h):h;
    var M = date.getMinutes();
    M = M<10?("0"+M):M;
    var str = y+"-"+m+"-"+d+" "+h+":"+M;
    return str;
}

//修改日程表
function openRevise(id){
    layer.open({
        type:2,
        area: ['800px', '300px'],
        title: '修改日程表',
        content: Feng.ctxPath + '/myScheduleForm/reviseSform?sformId='+id,

    });
}

//根据某个id删除删除日程表
function  isDelete(id) {
    layer.confirm('您是确定要删除该日程表吗？', {
            btn: ['确定','取消'] //按钮
        },
        function(){
            var $=layui.jquery;
            $.post({
                url:"/myScheduleForm/deleteSformBySformId?sformId="+id,

                success:function (data) {
                    alert("shre123")
                    console.log(data);
                    if (data.valueOf()=='删除日程表成功！') {
                       layer.msg(data.valueOf());
                        /*                            //关闭当前窗口
                                                    admin.closeThisDialog();*/
                        window.location.href="/myScheduleForm/showScheduleForm";

                    }else {
                        layer.msg(data.valueOf(),{icon: 5, anim: 6});
                    }
                }
            });

        });

}

//合并日程表
function combineSform(id) {
    alert(id);
    layer.open({
        type:2,
        area: ['800px', '500px'],
        title: '合并日程',
        content: Feng.ctxPath + '/myScheduleForm/loadcombineSform?sformId='+id,
    });
}

//修改日程框架
function reviseSframe( id, status) {
    alert("123413");
    if (status=='on') {
        layer.msg('发布后不能修改');
    }else {
        layer.open({
            type:2,
            area: ['800px', '500px'],
            title: '修改日程框架',
            content: Feng.ctxPath + '/myScheduleFrame/reviseSframe?sframeId='+id,

        });
    }


}

//复制日程框架
function copySframe(id) {
    layer.open({
        type:2,
        area: ['500px', '300px'],
        title: '复制日程框架',
        content: Feng.ctxPath + '/myScheduleFrame/loadCopySframe?sframeId='+id,
    });

}

//根据id删除日程框架
function deleteSframe(id) {
    alert("graeh");
    layer.confirm('您是否确定要删除该日程框架及框架项？', {
            btn: ['确定','取消'] //按钮
        },
        function(){
            var $=layui.jquery;
            $.post({
                url:"/myScheduleFrame/deleteSframeBySframeId",
                data:{'sframeId':id},
                success:function (data) {
                    console.log(data);
                    if (data.valueOf()=='日程框架删除成功！'){
                        layer.msg(data.valueOf());
                        /*                            //关闭当前窗口
                                                    admin.closeThisDialog();*/
                        window.location.href="/myScheduleFrame/showMyScheduleFrame";
                    }else {
                        layer.msg(data.valueOf(),{icon: 5, anim: 6});
                    }
                }
            });
        });

}